<template>
	<view class="content" style="position: relative;">
		
		<view class="backgroud-top" style="position: absolute;top: 0;">
			<image src="/static/index.jpg"></image>
		</view>
		<view class="job-box" style="margin-top: 300rpx;z-index: 10;">
			<view v-for="(item, index) in sysUsers" :key="index">
				<view class="job-box-item" v-if="index+1 == 1">
					<view class="rank-box-top">
						<view><image src="/static/rank/top1.png"></image></view>
						<view style="color: #ff5500;">{{item.nickName}}</view>
					</view>
					<view class="rank-box">
						<view class="rank-box-bar">
							<view :style="{ width: (item.score/3) + '%', backgroundColor: '#ff5500' }"></view>
						</view>
						<view class="rank-box-score">
							{{item.score}}分
						</view>
					</view>
				</view>
				
				<view class="job-box-item" v-if="index+1 == 2">
					<view class="rank-box-top">
						<view><image src="/static/rank/top2.png"></image></view>
						<view style="color: #ffaa00;">{{item.nickName}}</view>
					</view>
					<view class="rank-box">
						<view class="rank-box-bar">
							<view :style="{ width: (item.score/3) + '%', backgroundColor: '#ffaa00' }"></view>
						</view>
						<view class="rank-box-score">
							{{item.score}}分
						</view>
					</view>
				</view>
				
				
				<view class="job-box-item" v-if="index+1 == 3">
					<view class="rank-box-top">
						<view><image src="/static/rank/top3.png"></image></view>
						<view style="color: #55aa00;">{{item.nickName}}</view>
					</view>
					<view class="rank-box">
						<view class="rank-box-bar">
							<view :style="{ width: (item.score/3) + '%', backgroundColor: '#55aa00' }"></view>
						</view>
						<view class="rank-box-score">
							{{item.score}}分
						</view>
					</view>
				</view>
				
				
				<view class="job-box-item" v-if="index+1 > 3">
					<view class="rank-box-top">
						<view><view style="background-color: #55aaff;height: 40rpx;width: 40rpx;line-height: 40rpx;text-align: center;color: white;border-radius: 50rpx;font-size: 24rpx;">{{index+1}}</view></view>
						<view style="color: #55aaff;">{{item.nickName}}</view>
					</view>
					<view class="rank-box">
						<view class="rank-box-bar">
							<view :style="{ width: (item.score/3) + '%', backgroundColor: '#55aaff' }"></view>
						</view>
						<view class="rank-box-score">
							{{item.score}}分
						</view>
					</view>
				</view>
				
				
				
			</view>
			
			
			
			
			
		</view>
		
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				sysUsers:[]
			}
		},
		onShow() {
			this.getUsers()
		},
		methods: {
			getUsers(){
				this.$http({
					url: '/forms/forms/list1',
					method: 'get',
				}).then(res => {
					if(res && res.rows){
						this.sysUsers = res.rows
					}
					
				});
			},
			
			
		}
	}
</script>

<style lang="scss">
	

	.backgroud-top {
		width: 720rpx;
		background: white;
		border-radius: 20rpx;
		
		image {
			width: 100%;
			border-radius: 20rpx;
		}
	}
	.job-box {
		background: white;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: wrap;
		width: 680rpx;
		padding-top: 20rpx;
		margin-top: 20rpx;
		border-radius: 10rpx;
		min-height: 300rpx;
		opacity: 0.85;
		view{
			width: 100%;
			
			.job-box-item {
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				height: 100rpx;
				width: 100%;
				font-size: 32rpx;
				margin-bottom: 30rpx;
				
				.rank-box-top{
					display: flex;
					width: 90%;
					height: 45rpx;
					
					view:nth-child(1) {
						width: 10%;
						font-weight: bolder;
						image{
							height: 40rpx;
							width: 40rpx;
						}
					}
					view:nth-child(2) {
						width: 50%;
					}
					
				}
				.rank-box{
					display: flex;
					width: 90%;
					height: 30rpx;
					margin-top: 15rpx;
					.rank-box-bar{
						display: flex;
						background-color: #ebeef5;
						width: 80%;
						border-radius: 10rpx;
						height: 25rpx;
						view{
							height: 25rpx;
							border-radius: 10rpx;
						}
					}
					.rank-box-score{
						display: flex;
						width: 20%;
						font-size: 30rpx;
						height: 30rpx;
						justify-content: flex-end;
						align-items: center;
						color: red;
					}
				}
				
			}
			
			
		}
	
		
	}
	
</style>